﻿
<script src="~/Scripts/jquery.form.js"></script>
<style>
    #demo label {
        font-weight: 500;
    }

    .caoZuoAnNiu {
        margin: 5px
    }
</style>
<script>
    function xiao(e) {
        var size = parseInt($("#selectYe").val());
        adminValue(1, e, size);
        fenYe(2, e, size);
    }
    function adminValue(id, page, size) {
        var name = $("#strYhm").val();

        var gaoID = $("#gaoID").val();
        var gaoName = $("#gaoName").val();
        var myDep = $("#myDep").val();
        var myRole = $("#myRole").val();


        //用户信息添加
        $.ajax({
            type: "Get",
            url: "http://localhost:64068/api/AdminAjax",
            data: { id: id, page: page, size: size, msg: name, UserCode: gaoID, UserName: gaoName, DepartNum: myDep, RoleNum: myRole },
            success: (res => {
                console.log(res);
                $("#myTable tbody tr").remove();
                for (var i = 0; i < res.length; i++) {
                    var myTable = $("#myTable tbody");
                    var tr = "<tr>";
                    tr += "<td><input type='checkbox' class='checkbox' id='check_" + res[i].ID + "' name='" + res[i].ID + "' /></td>";
                    tr += "<td>" + res[i].UserName + "</td>";
                    tr += "<td>" + res[i].UserCode + "</td>";
                    tr += "<td>" + res[i].RealName + "</td>";
                    tr += "<td>" + res[i].Email + "</td>";
                    tr += "<td>" + res[i].Phone + "</td>";
                    tr += "<td>" + res[i].LoginCount + "</td>";
                    var log = true;
                    $("#myDep option").each(function () {
                        if ($(this).attr("value") == res[i].DepartNum) {
                            tr += "<td>" + $(this).text() + "</td>";
                            log = false;
                        }
                    })
                    if (log) {
                        tr += "<td></td>"
                    }
                    log = true;
                    $("#myRole option").each(function () {

                        if ($(this).attr("value") == res[i].RoleNum) {
                            tr += "<td>" + $(this).text() + "</td>";
                            log = false;
                        }
                    })
                    if (log) {
                        tr += "<td></td>"
                    }
                    tr += "<td><a class='caoZuoAnNiu'  onclick=up('" + res[i].UserCode + "','" + res[i].UserName + "','" + res[i].RealName + "','" + res[i].Email + "','" + res[i].Mobile + "','" + res[i].Phone + "','" + res[i].DepartNum + "','" + res[i].RoleNum + "')><span class='glyphicon glyphicon-edit'></span></a><a class='caoZuoAnNiu' onclick=del(" + res[i].ID + ")><span class='glyphicon glyphicon-remove'></span></a></td>"
                    tr += "</tr>";
                    myTable.append(tr);
                }
            })
        })
        //角色下拉框添加

    }
    function fenYe(id, page, size) {

        var name = $("#strYhm").val();
        var gaoID = $("#gaoID").val();
        var gaoName = $("#gaoName").val();
        var myDep = $("#myDep").val();
        var myRole = $("#myRole").val();
        $.ajax({
            type: "Get",
            url: "http://localhost:64068/api/AdminAjax",
            data: { id: id, page: page, size: size, msg: name, UserCode: gaoID, UserName: gaoName, DepartNum: myDep, RoleNum: myRole },
            success: (res => {
                $("#fenYe li.xiao").remove();

                $("#pageV").val(res[2])
                $("#pageCountV").val(res[0])
                $("#countV").val(res[1])
                var li = "";
                for (var i = 0; i < res[0]; i++) {
                    if (res[2] == i + 1) {
                        li += "<li class='active xiao' onclick='xiao(" + (i + 1) + ")'><a>" + (i + 1) + "</a></li>";
                    } else {
                        li += "<li class='xiao' onclick='xiao(" + (i + 1) + ")'><a>" + (i + 1) + "</a></li>";
                    }
                }
                $("#fenYe1").after(li);

                $("#count").text(res[1])
                $("#fenYe2").removeClass("disabled")
                $("#fenYe1").removeClass("disabled")

                if (res[0] <= page) {
                    $("#fenYe2").addClass("disabled")
                }
                if (1 >= page) {
                    $("#fenYe1").addClass("disabled")
                }
            })
        })
    }

    function del(res) {
        if (confirm("确认删除吗？")) {

            $.ajax({
                url: "http://localhost:64068/api/AdminAjax/" + res,
                type: "Delete",
                success: function (e) {
                    if (e == 1) {
                        alert("删除成功");

                        var xuan = parseInt($("#selectYe").val());

                        adminValue(1, 1, xuan);

                        //分页
                        fenYe(2, 1, xuan);
                    } else {
                        alert("删除失败")
                    }
                }
            })
        }
    }
    //修改
    //res[i].ID + "," + res[i].UserName + "," + res[i].RealName + "," + res[i].Email + "," + res[i].Mobile + "," + res[i].Phone + "," + res[i].DepartNum + "," + res[i].RoleNum
    function up(UserCode, UserName, RealName, Email, Mobile, Phone, DepartNum, RoleNum) {
        var UserCodes = $("#UserCode3").val(UserCode);
        var UserNames = $("#UserName3").val(UserName);
        var RealNames = $("#RealName3").val(RealName);
        var Emails = $("#Email3").val(Email);
        var Mobiles = $("#Mobile3").val(Mobile);
        var Phones = $("#Phone3").val(Phone);
        var DepartNums = ""
        if (DepartNum == "") {
            DepartNum = $("#upMyDep").val(0);
        } else {
            DepartNums = $("#upMyDep").val(DepartNum);
        }


        var RoleNums = ""
        if (RoleNum == "") {
            RoleNums = $("#upMyRole").val(0);
        } else {
            RoleNums = $("#upMyRole").val(RoleNum);
        }
        $("#upMyModal").modal('show')
        //

    }

</script>
<div class="panel panel-default">
    <div class="panel-heading">
        @*标题*@
        <div class="panel-title" style="display:flex;justify-content:space-between">

            <div style="display:flex;align-items:center">
                <span class="glyphicon glyphicon-globe"></span>
                &nbsp;用户管理
            </div>

            <div>
                <button class="btn btn-primary" data-toggle="modal" data-target="#addMyModal" id="add">
                    <span class="glyphicon glyphicon-pencil"></span>&nbsp;新增
                </button>
                <button class="btn btn-danger" id="del">
                    <span class="glyphicon glyphicon-trash"></span>&nbsp;删除
                </button>
                <button class="btn btn-info">
                    <span class="glyphicon glyphicon-download"></span>&nbsp;导出
                </button>
            </div>
        </div>
        @*标题结束*@
    </div>
    <div class="panel-body">
        @* 搜索开始 *@
        <div style="display:flex;align-items:center">
            <input type="text" name="name" value="" id="strYhm" placeholder="请输入用户名或者工号" class="form-control" />
            <button class="btn btn-info" style="margin:0 5px" id="btnStr"><span class="glyphicon glyphicon-search"></span>&nbsp;搜索</button>
            <button class="btn btn-primary" data-toggle="collapse" data-target="#demo" id="xiaLa">高级搜索&nbsp;<span class="glyphicon glyphicon-chevron-down" id="xiaLaTu"></span></button>
        </div>
        @* 搜索结束 *@
        @* 高级搜索开始 *@
        <div id="demo" class="collapse">
            <div style="display:flex;margin-top: 20px; padding: 20px; border: 1px #dddddd solid; ">
                <div class="form-group col-md-2">
                    <label>员工编号</label>
                    <input type="text" name="name" value="" id="gaoID" class="" />
                </div>
                <div class="form-group col-md-2">
                    <label>员工姓名</label>
                    <input type="text" name="name" value="" id="gaoName" class="" />
                </div>
                <div class="form-group col-md-2">
                    <label>部门</label>
                    <select class="form-control" name="DepartNum" id="myDep">
                        <option selected value="0">请选择部门</option>

                    </select>
                </div>
                <div class="form-group col-md-2">
                    <label>角色</label>
                    <select class="form-control" name="RoleNum" id="myRole">
                        <option value="0" selected>请选择角色</option>

                    </select>
                </div>
                <div class="form-group col-md-2">
                    <div>&nbsp;</div>
                    <button class="btn btn-info" style="margin-top:5px " id="gaoBtn"><span class="glyphicon glyphicon-search"></span>&nbsp;搜索</button>
                </div>
            </div>

        </div>
        @* 高级搜索结束 *@
        <div style="margin-top:20px">
            <table class="table table-striped" id="myTable">
                <thead>
                    <tr>
                        <th width="5%"><input type="checkbox" name="name" class="checkboxs" value="" id="checkF" /></th>
                        <th width="12%">用户名</th>
                        <th width="10%">编号</th>
                        <th width="10%">真名</th>
                        <th width="13%">Email</th>
                        <th width="13%">联系方式</th>
                        <th width="10%">登录次数</th>
                        <th width="11%">部门</th>
                        <th width="11%">角色</th>
                        <th width="5%">操作</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="10">
                            <div style="display: flex; justify-content: space-between ">


                                <div style="display:flex;align-items:center;">
                                    共<span id="count"></span>行，每页
                                    <select class="form-control" style="width:70px" id="selectYe">
                                        <option value="1">1</option>
                                        <option value="2">2</option>
                                        <option value="3">3</option>
                                        <option value="4">4</option>
                                        <option value="5">5</option>
                                        <option value="6">6</option>
                                        <option value="7">7</option>
                                        <option value="8">8</option>
                                        <option value="9">9</option>
                                        <option selected value="10">10</option>
                                    </select>
                                    行
                                </div>
                                <nav>
                                    <ul class="pagination" id="fenYe">
                                        <li id="fenYe1">
                                            <a>
                                                <span>&laquo;</span>
                                            </a>
                                        </li>
                                        <li id='fenYe2'><a><span>&raquo;</span></a></li>
                                    </ul>
                                </nav>
                            </div>
                        </td>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>
</div>

<!--  用户信息添加 模态框（Modal） -->
<div class="modal fade" id="addMyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <form action="/api/AdminAjax" method="post" id="addMyForm">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">添加用户</h4>
                </div>
                <div class="modal-body box">
                    <div>
                        <div>用户编号</div><input type="text" class="form-control" disabled name="UserCode" id="UserCode2" value="" placeholder="自动生成，可不填" />
                        <div>用户名</div><input type="text" class="form-control" name="UserName" id="UserName" value="" placeholder="请输入用户名" />
                    </div>
                    <div>
                        <div>密码</div><input type="password" class="form-control" name="PassWord" id="PassWord" value="" placeholder="请输入密码" />
                        <div>确认密码</div><input type="password" class="form-control" name="regPassWord" id="regPassWord" value="" placeholder="请输入确认密码" />
                    </div>
                    <div>
                        <div>真名</div><input type="text" class="form-control" name="RealName" id="RealName2" value="" />
                        <div>Email</div><input type="text" class="form-control" name="Email" id="Email2" value="" />
                    </div>
                    <div>
                        <div>电话</div><input type="text" class="form-control" id="Mobile2" name="Mobile" value="" />
                        <div>手机</div><input type="text" class="form-control" id="Phone2" name="Phone" value="" />
                    </div>
                    <div>
                        <div>部门</div>
                        <select class="form-control" name="DepartNum" id="addMyDep">
                            <option selected value="0">请选择部门</option>

                        </select>


                        <div>角色</div>

                        <select class="form-control" name="RoleNum" id="addMyRole">
                            <option value="0" selected>请选择角色</option>
                        </select>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary">确定</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </form>
</div>


<!--  用户信息添加 模态框（Modal） -->
<div class="modal fade" id="upMyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">修改用户</h4>
            </div>
            <div class="modal-body box">
                <div>
                    <div>用户编号</div><input type="text" class="form-control" disabled name="UserCode" id="UserCode3" value="" placeholder="自动生成，可不填" />
                    <div>用户名</div><input type="text" class="form-control" name="UserName" id="UserName3" value="" placeholder="请输入用户名" />
                </div>
                <div>
                    <div>密码</div><input type="password" class="form-control" name="PassWord" id="PassWord3" value="" placeholder="请输入密码" />
                    <div>确认密码</div><input type="password" class="form-control" name="regPassWord" id="regPassWord3" value="" placeholder="请输入确认密码" />
                </div>
                <div>
                    <div>真名</div><input type="text" class="form-control" name="RealName" id="RealName3" value="" />
                    <div>Email</div><input type="text" class="form-control" name="Email" id="Email3" value="" />
                </div>
                <div>
                    <div>电话</div><input type="text" class="form-control" id="Mobile3" name="Mobile" value="" />
                    <div>手机</div><input type="text" class="form-control" id="Phone3" name="Phone" value="" />
                </div>
                <div>
                    <div>部门</div>
                    <select class="form-control" name="DepartNum" id="upMyDep">
                        <option selected value="0">请选择部门</option>

                    </select>


                    <div>角色</div>

                    <select class="form-control" name="RoleNum" id="upMyRole">
                        <option value="0" selected>请选择角色</option>
                    </select>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" id="btnUp">确定</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<input type="hidden" id="pageV" value="" />
<input type="hidden" id="countV" value="" />
<input type="hidden" id="pageCountV" value="" />
<input type="hidden" id="type" value="post" />
<script>
    $(function () {
        //修改按钮
        $("#btnUp").click(function () {
            var falg = true;

            if (falg) {
                var UserName = $("#UserName3").val();
                if (UserName != "") {
                    if (UserName.length < 3) {
                        alert("用户名必须大于三个字符");
                        falg = false;
                    }
                }
                else {
                    alert("用户名不能为空");
                    falg = false;
                }
            }

            if (falg) {
                var PassWord = $("#PassWord3").val();
                var regPassWord = $("#regPassWord3").val();
                    if (PassWord != regPassWord) {
                        alert("两次密码必须一致");
                        falg = false;
                    }
            }

            if (falg) {
                var zhengzeEmail = /^\w+([-+.]\w+)*@@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
                var Email2 = $("#Email3").val();
                if (Email2 != "") {
                    if (!zhengzeEmail.test(Email2)) {
                        alert("邮箱格式错误")
                        falg = false;
                    }
                }
            }
            if (falg) {
                var zhengzeMobile = /^\d{3}-\d{8}|\d{4}-\d{7}$/;
                var Mobile2 = $("#Mobile3").val();
                if (Mobile2 != "") {
                    if (!zhengzeMobile.test(Mobile2)) {
                        alert("电话格式错误")
                        falg = false;
                    }
                }
            }
            if (falg) {
                var zhengzePhone = /^1[3,5,6,8]\d{9}$/;
                var Phone2 = $("#Phone3").val();
                if (Phone2 != "") {
                    if (!zhengzePhone.test(Phone2)) {

                        alert("手机格式错误")
                        falg = false;
                    }
                }
            }
            if (falg) {
                var UserCodes = $("#UserCode3").val();
                var UserNames = $("#UserName3").val();
                var RealNames = $("#RealName3").val();
                var PassWord = $("#PassWord3").val();
                var Emails = $("#Email3").val();
                var Mobiles = $("#Mobile3").val();
                var Phones = $("#Phone3").val();
                var DepartNums = $("#upMyDep").val();
                var RoleNums = $("#upMyRole").val();
                $.ajax({
                    type: "Put",
                    url: "http://localhost:64068/api/AdminAjax/" + UserCodes,
                    async: false,
                    data: { "UserCode": UserCodes, "UserName": UserNames, "PassWord": PassWord, "RealName": RealNames, "Email": Emails, "Mobile": Mobiles, "Phone": Phones, "DepartNum": DepartNums, "RoleNum": RoleNums },
                    success: (res => {
                        if (res > 0) {
                            alert("修改成功");
                            $('#upMyModal').modal('hide')
                            var xuan = parseInt($("#selectYe").val());

                            adminValue(1, 1, xuan);

                            //分页
                            fenYe(2, 1, xuan);

                            $("#UserName3").val("");
                            $("#PassWord3").val("");
                            $("#regPassWord3").val("");
                            $("#RealName3").val("");
                            $("#Email3").val("");
                            $("#Mobile3").val("");
                            $("#Phone3").val("");
                            $("#upMyDep").val(0);
                            $("#upMyRole").val(0);
                        } else {
                            alert("修改失败");
                        }
                    })
                })
            }
        })
        //添加按钮
        $("#add").click(function () {
            $("#UserCode2").val("");
            $("#UserName").val("");
            $("#PassWord").val("");
            $("#regPassWord").val("");
            $("#RealName2").val("");
            $("#Email2").val("");
            $("#Mobile2").val("");
            $("#Phone2").val("");
            $("#addMyDep").val(0);
            $("#addMyRole").val(0);
        })
        //普通搜索按钮
        $("#btnStr").click(function () {
            var size = parseInt($("#selectYe").val());
            adminValue(1, 1, size);
            //分页
            fenYe(2, 1, size);
        })
        //高级搜索按钮
        $("#gaoBtn").click(function () {
            var size = parseInt($("#selectYe").val());
            adminValue(3, 1, size);
            //分页
            fenYe(4, 1, size);
        })
        //全选
        $("#checkF").change(function () {
            var flg = $(this).prop("checked");
            $(".checkbox").each(function () {
                $(this).prop("checked", flg);
            })
        })
        $("#del").click(function () {
            if ($(".checkbox:checked").length > 0) {
                if (confirm("确认删除吗？")) {

                    //alert($(".checkbox").eq(0).attr("checked))
                    var falg = 0;
                    var num = 0;
                    $(".checkbox:checked").each(function () {
                        num += 1;
                        var id = $(this).attr("name");
                        $.ajax({
                            url: "http://localhost:64068/api/AdminAjax/" + id,
                            type: "Delete",
                            //把异步变同步，先执行完当前ajax代码，再执行后面代码
                            async: false,
                            success: function (e) {
                                if (e == 1) {
                                    falg += 1;
                                }
                            }
                        })
                    })
                    if (falg == num) {
                        alert("删除成功");

                        var xuan = parseInt($("#selectYe").val());

                        adminValue(1, 1, xuan);

                        //分页
                        fenYe(2, 1, xuan);
                    } else if (num > falg) {
                        var xuan = parseInt($("#selectYe").val());

                        adminValue(1, 1, xuan);

                        //分页
                        fenYe(2, 1, xuan);
                        alert("部分删除失败")
                    } else {
                        alert("删除失败")
                    }
                }
            } else {
                alert("请选择至少一位用户！");
            }
        })
        //非空验证和正则验证
        $("#addMyForm").submit(function (e) {
            var falg = true;

            if (falg) {
                var UserName = $("#UserName").val();
                if (UserName != "") {
                    if (UserName.length < 3) {
                        alert("用户名必须大于三个字符");
                        falg = false;
                    }
                }
                else {
                    alert("用户名不能为空");
                    falg = false;
                }
            }

            if (falg) {
                var PassWord = $("#PassWord").val();
                var regPassWord = $("#regPassWord").val();
                if (PassWord != "") {
                    if (PassWord != regPassWord) {
                        alert("两次密码必须一致");
                        falg = false;
                    }
                }
                else {
                    alert("密码不能为空");
                    falg = false;
                }
            }

            if (falg) {
                var zhengzeEmail = /^\w+([-+.]\w+)*@@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
                var Email2 = $("#Email2").val();
                if (Email2 != "") {
                    if (!zhengzeEmail.test(Email2)) {
                        alert("邮箱格式错误")
                        falg = false;
                    }
                }
            }
            if (falg) {
                var zhengzeMobile = /^\d{3}-\d{8}|\d{4}-\d{7}$/;
                var Mobile2 = $("#Mobile2").val();
                if (Mobile2 != "") {
                    if (!zhengzeMobile.test(Mobile2)) {
                        alert("电话格式错误")
                        falg = false;
                    }
                }
            }
            if (falg) {
                var zhengzePhone = /^1[3,5,6,8]\d{9}$/;
                var Phone2 = $("#Phone2").val();
                if (Phone2 != "") {
                    if (!zhengzePhone.test(Phone2)) {

                        alert("手机格式错误")
                        falg = false;
                    }
                }
            }
            return falg;
        })
        //表单提交后
        $("#addMyForm").ajaxForm(function (data) {
            if (data == "0") {
                alert("添加成功");
                $('#addMyModal').modal('hide')
                var xuan = parseInt($("#selectYe").val());
                var page = parseInt($("#countV").val()) + 1;

                adminValue(1, Math.ceil(page * 1.0 / xuan), xuan);

                //分页
                fenYe(2, Math.ceil(page * 1.0 / xuan), xuan);

                $("#UserName").val("");
                $("#PassWord").val("");
                $("#regPassWord").val("");
                $("#RealName2").val("");
                $("#Email2").val("");
                $("#Mobile2").val("");
                $("#Phone2").val("");
                $("#addMyDep").val(0);
                $("#addMyRole").val(0);
            }
            else {
                alert("添加失败");
            }
        })
        $("#selectYe").change(function () {
            //用户信息添加
            adminValue(1, 1, parseInt($(this).val()));
            //分页
            fenYe(2, 1, parseInt($(this).val()));
        })
        $("#fenYe1").click(function () {
            var page = parseInt($("#pageV").val()) - 1;
            var size = parseInt($("#selectYe").val());
            if (0 >= page) {
                $("#fenYe1").addClass("disabled")
            } else {
                adminValue(1, page, size);
                fenYe(2, page, size);
            }
        })

        $("#fenYe2").click(function () {

            var page = parseInt($("#pageV").val()) + 1;
            var countPage = parseInt($("#pageCountV").val());
            var size = parseInt($("#selectYe").val());
            if (countPage < page) {
                $("#fenYe2").addClass("disabled")
            } else {

                var page = parseInt($("#pageV").val()) + 1;
                var size = parseInt($("#selectYe").val());
                adminValue(1, page, size);
                fenYe(2, page, size);
            }
        })

        //下拉框添加
        xiaLaKuanValue();
        function xiaLaKuanValue() {
            //部门下拉框添加
            $.ajax({
                type: "Get",
                url: "http://localhost:64068/api/AdminAjax/2",
                async: false,
            }).then(res => {
                for (var i = 0; i < res.length; i++) {
                    $("#myDep").append("<option value=" + res[i].DepartNum + ">" + res[i].DepartName + "</option>")
                    $("#addMyDep").append("<option value=" + res[i].DepartNum + ">" + res[i].DepartName + "</option>")
                    $("#upMyDep").append("<option value=" + res[i].DepartNum + ">" + res[i].DepartName + "</option>")
                }
            })
            //角色下拉框添加
            $.ajax({
                type: "Get",
                url: "http://localhost:64068/api/AdminAjax/1",
                async: false,
            }).then(res => {
                for (var i = 0; i < res.length; i++) {
                    $("#myRole").append("<option value=" + res[i].RoleNum + ">" + res[i].RoleName + "</option>")
                    $("#addMyRole").append("<option value=" + res[i].RoleNum + ">" + res[i].RoleName + "</option>")
                    $("#upMyRole").append("<option value=" + res[i].RoleNum + ">" + res[i].RoleName + "</option>")
                }
            })
        }
        //用户信息添加
        adminValue(1, 1, 10);

        //分页
        fenYe(2, 1, 10);

        //高级搜索下拉框点击事件
        $("#xiaLa").click(function () {
            var ins = $("#demo").attr("class");
            if (ins != "collapse in") {
                $("#xiaLaTu").addClass("glyphicon-chevron-up");
                $("#xiaLaTu").removeClass("glyphicon-chevron-down");
            } else {
                $("#xiaLaTu").removeClass("glyphicon-chevron-up");
                $("#xiaLaTu").addClass("glyphicon-chevron-down");
            }
        })
    })
</script>
